<?php
	session_start();
	ob_start();

	require("./inc/config-system.inc.php");
	require("./inc/config-db.inc.php");
	require("./inc/fm.inc.php");
	require("./class/adodb/adodb.inc.php");

	// connection database
	$objConn = ADONewConnection(DB_DRIVER);
	$objConn->Connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>สมุดรายวันจ่ายเงิน</title>
<style type="text/css">
<!--
.center {
	text-align: center;
	font-weight: normal;
	font-size: 15px;
	font-family: "Microsoft Sans Serif";
}
.right {
	text-align: right;
}
.body {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
	margin-top: 0px;
}
.input {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
}

.numeric {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
}

.header_center {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
	text-decoration: underline;
	text-align: center;
	font-weight: bold;
	color: #FFF;
	background-color: #F00;
}
.input_disable {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
	color: #000;
	background-color: #CCC;
}
.input_focus {
	font-family: "Microsoft Sans Serif";
	font-size: 15px;
	background-color: #FFC;
	border: 2px solid #F60;
}
input[type="submit"], input[type="button"] {
	position: relative;
	vertical-align: top;
	width: 10%;
	height: 50px;
	padding: 0;
	font-size: 20px;
	color: white;
	text-align: center;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	background: #2ecc71;
	border: 0;
	border-bottom: 2px solid #28be68;
	cursor: pointer;
	-webkit-box-shadow: inset 0 -2px #28be68;
	box-shadow: inset 0 -2px #28be68;
}
input[type="submit"]:active, input[type="button"]:active {
	top: 1px;
	outline: none;
	-webkit-box-shadow: none;
	box-shadow: none;
}
input[type="text"]  {
	padding: 5px;
	border-radius: 3px;
	border: 1px solid #CCC;
	background-image: none;
}
input[type="text"]:focus {
	outline-color: #54B4AD;
}
-->
</style>

<link href="./css/datepicker.css" rel="stylesheet" type="text/css" media="screen" />
<link href="./css/slidepanel.css" rel="stylesheet" type="text/css" media="screen" />
<link href="./css/autocomplete.css" rel="stylesheet" type="text/css" media="screen" />
<link href="./css/select2.css" rel="stylesheet" type="text/css" media="screen" />

<script type="text/javascript" src="./js/jquery_1.8.3.inc.js"></script>
<script type="text/javascript" src="./js/form.inc.js"></script>
<script type="text/javascript" src="./js/datepicker.inc.js"></script>
<script type="text/javascript" src="./js/livequery.inc.js"></script>
<script type="text/javascript" src="./js/autocomplete.inc.js"></script>
<script type="text/javascript" src="./js/blockui.inc.js"></script>
<script type="text/javascript" src="./js/alphanumeric.inc.js"></script>
<script type="text/javascript" src="./js/numeric.inc.js"></script>
<script type="text/javascript" src="./js/select2.js" ></script>

<?php require("./ap.inc.js.php"); ?>
</head>
<body class="body">

<div id="mainPanel">
    <div id="panel"><?php require("./menu.inc.php"); ?></div>
    <p class="slide"><a href="#" class="btn-slide">Main Menu</a></p>
</div>

<br /><br />

<form id="ap_posting" method="post" action="./ap_post.php">

    <table width="100%" border="0" cellpadding="5" cellspacing="5" class="body">
        <tr class="header_center">
            <td colspan="10"><h1>สมุดรายวันจ่ายเงิน</h1></td>
        </tr>
        <tr>
            <td colspan="10">&nbsp;</td>
        </tr>
        <tr>
            <td colspan="10">วันที่ :<br />
            <input name="TXTdoc_date[]" type="text" class="input" id="TXTdoc_date_0" readonly="readonly" /></td>
		</tr>
        <tr>
            <td colspan="10">&nbsp;</td>
        </tr>
        <tr bgcolor="#FFCC99">
            <td width="20%">รายการ</td>
            <td width="10%">งบประมาณ</td>
            <td width="10%">ชื่อผู้ชำระเงิน</td>
            <td width="11%">หมายเหตุ</td>
			<td width="5%">จำนวน</td>
            <td width="4%">ราคา/หน่วย</td>
			<td width="10%">&nbsp;</td>
			<td width="9%">เงินฝาก</td>
			<td width="9%">กระแส</td>
            <td width="9%">มัดจำ</td>
		</tr>
        <tr id="rowNo_0">
			<td><input name="TXTdescription[]" type="text" class="input" id="TXTdescription_0" size="35" /></td>
			<td>
			<?php
				$sqlCommand = "SELECT budget_name, budget_code FROM tbl_budget ORDER BY budget_code";
				$recordset = $objConn->Execute($sqlCommand);
				echo $recordset->GetMenu("SELbudget[]", "", true, false, 0, "class='input'");
            ?>
			</td>
            <td>
			<?php
				$sqlCommand = "(SELECT payer_name, payer_code FROM tbl_customer ORDER BY payer_id) UNION (SELECT payer_name, payer_code FROM tbl_vendor ORDER BY payer_id)";
				$recordset = $objConn->Execute($sqlCommand);
				echo $recordset->GetMenu("SELpayer[]", "", true, false, 0, "class='input'");
            ?>
			</td>
            <td><input name="TXTremark[]" type="text" class="input" id="TXTremark_0" size="35" /></td>
            <td><input name="TXTquantity[]" type="text" class="input_disable" id="TXTquantity_0" size="5" readonly="readonly" /></td>
            <td><input name="TXTprice_unit[]" type="text" class="input_disable" id="TXTprice_unit_0" size="5" readonly="readonly" /></td>
            <td>&nbsp;</td>
            <td bgcolor="#FFCC99"><input name="TXTsaving[]" type="text" class="numeric" id="TXTsaving_0" size="10" /></td>
            <td bgcolor="#FFCC99"><input name="TXTcurrent[]" type="text" class="numeric" id="TXTcurrent_0" size="10" /></td>
            <td bgcolor="#FFCC99"><input name="TXTpledge[]" type="text" class="numeric" id="TXTpledge_0" size="10" /></td>
      	</tr>
        <tr id="addNewRow">
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td class="right">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td colspan="2">&nbsp;</td>
            <td colspan="2" bgcolor="#FFCC99">จำนวนรวมทั้งหมด :</td>
            <td bgcolor="#FFCC99"><input name="TXTtotal_amount_saving" type="text" class="input_disable" id="TXTtotal_amount_saving" value="" size="10" readonly='readonly' /></td>
            <td bgcolor="#FFCC99"><input name="TXTtotal_amount_current" type="text" class="input_disable" id="TXTtotal_amount_current" value="" size="10" readonly='readonly' /></td>
            <td bgcolor="#FFCC99"><input name="TXTtotal_amount_pledge" type="text" class="input_disable" id="TXTtotal_amount_pledge" value="" size="10" readonly='readonly' /></td>
        </tr>
        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
		</tr>
        <tr class="center">
            <td colspan="10">
				<input name="BTTnewrow" type="button" class="input" id="BTTnewrow" value="เพิ่มแถว" />
                <input name="BTTremoverow" type="button" class="input" id="BTTremoverow" value="ลบแถวล่าสุด" />
            	<input name="BTTsimulate" type="submit" class="input" id="BTTsimulate" value="ตรวจสอบก่อนบันทึก" />
                <input name="BTTpost" type="submit" class="input" id="BTTpost" value="บันทึก" />
                <input name="HIDnum_row" id="HIDnum_row" type="hidden" value="0" />
            </td>
        </tr>

    </table>

	<br />
    <hr />
    <br />
    กรุณาใส่เบอร์เอกสารที่ต้องการลบ<br />
    <input name="TXTdeldoc[]" type="text" class="numeric" id="TXTdeldoc_0" />
    <input name="BTTdeldoc" type="submit" class="input" id="BTTdeldoc" value="ลบเอกสาร" />
    <br /><br />
    <hr />

</form>

</body>
</html>

<?php ob_end_flush(); ?>
